package com.szrt.oa.menu.controller;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.szrt.oa.base.controller.BaseController;
import com.szrt.oa.menu.entity.MenuEntity;
import com.szrt.oa.menu.service.MenuService;

@Controller
@RequestMapping("/menu")
public class MenuController extends BaseController<MenuEntity> {
	
	
	@Autowired
	private MenuService service;
	
	//http://localhost:8090/super-base-ssm/menu/insert.do?menuName=lh
	//http://localhost:8090/super-base-ssm/menu/insert.do
	@RequestMapping("/insert")
	@ResponseBody
	public Map<String, Object> myInsert(MenuEntity entity) {
		
		Map<String, Object> insert = service.queryAll();
		return insert;
	}
	
	
	//http://localhost:8090/super-base-ssm/menu/myfind.do?menuName=lh
	//http://localhost:8090/super-base-ssm/menu/myfind.do
	@RequestMapping("/myfind")
	@ResponseBody
	public Map<String, Object> myfind(MenuEntity entity) {
		
		Map<String, Object> queryAll = service.queryAll();
		return queryAll;
	}
	//http://localhost:8090/super-base-ssm/menu/mydeleteByid.do?id=1
	//http://localhost:8090/super-base-ssm/menu/mydeleteByid.do
	@RequestMapping("/mydelete")
	@ResponseBody
	public Map<String, Object>  mydeleteByid(MenuEntity entity) {
		
		Map<String, Object>  mydelete = service.deleteByid(entity);
		return mydelete;
	}
	
	//http://localhost:8090/super-base-ssm/menu/myupdate.do?menuName=lh&id=6004
	@RequestMapping("/myupdate")
	@ResponseBody
	public Map<String, Object>  myupdate(MenuEntity entity) {
		
		Map<String, Object>  myupdate = service.update(entity);
		return myupdate;
	}
	
	//http://localhost:8090/super-base-ssm/menu/myinsert.do?menuName=test管理
	//http://localhost:8090/super-base-ssm/menu/myinsert.do
	@RequestMapping("/myinsert")
	@ResponseBody
	public Map<String, Object>  myinsert(MenuEntity entity) {
		
		Map<String, Object>  myinsert = service.insert(entity);
		return myinsert;
	}

}
